﻿@{
    ViewBag.Title = "编辑控件";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    var controlId = request('controlId');
    var dataJson = top.Form.bindingFormJson;
    $(function () {
        $.each(dataJson, function (i) {
            if (dataJson[i].column == controlId) {
                var data = dataJson[i];
                $("#ControlId").val(data.column);
                $("#ControlName").val(data.remark);
                //$("#form1").SetWebControls(data);
                //$("input[name='ControlColspan'][value=" + data.ControlColspan + "]").attr("checked", true);
                return false;
            }
        });
    })
    //保存表单
    function AcceptClick(callBack) {
        var data = {
            ControlId: $("#ControlId").val(),
            ControlName: $("#ControlName").val()
            //ControlValidator: $("#ControlValidator").val(),
            //ControlType: $("#ControlType").val(),
            //ControlColspan: $("input[name='ControlColspan']:checked").val(),
            //ControlDefault: $("#ControlDefault").val()
        }
        if (data.ControlName == "") {
            dialogTop("请填写字段名称", "error");
        }
        else {
            callBack(data);
            dialogClose();
        }
    }
</script>

<div style="margin-left: 10px; margin-top: 20px; margin-right: 30px;">
    <table class="form">
        <tr>
            <th class="formTitle">字段标识</th>
            <td class="formValue">
                <input id="ControlId" disabled type="text" class="form-control" />
            </td>
        </tr>
        <tr>
            <th class="formTitle">字段名称</th>
            <td class="formValue">
                <input id="ControlName" type="text" class="form-control" />
            </td>
        </tr>
        @*<tr>
            <td class="formTitle">字段验证</td>
            <td class="formValue">
                <select id="ControlValidator" class="form-control">
                    <option value="">==请选择==</option>
                    <option value="NotNull">不能为空</option>
                    <option value="Num">数字</option>
                    <option value="NumOrNull">数字或空</option>
                    <option value="Double">小数</option>
                    <option value="DoubleOrNull">小数或空</option>
                    <option value="Phone">必须电话格式</option>
                    <option value="PhoneOrNull">必须电话格式或空</option>
                    <option value="Mobile">手机格式</option>
                    <option value="MobileOrNull">手机格式或空</option>
                    <option value="Email">电子邮件格式</option>
                    <option value="isEmailOrNull">电子邮件格式或空</option>
                    <option value="IDCard">身份证格式</option>
                    <option value="IDCardOrNull">身份证格式或空</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class="formTitle">字段类型</td>
            <td class="formValue">
                <select id="ControlType" class="form-control">
                    <option value="input">文本框</option>
                    <option value="select">下拉框</option>
                    <option value="datetime">日期框</option>
                    <option value="textarea">文本区</option>
                </select>
            </td>
        </tr>
        <tr>
            <th class="formTitle">合并列</th>
            <td class="formValue">
                <div class="radio">
                    <label>
                        <input name="ControlColspan" type="radio" checked="checked" value="0">
                        不合并
                    </label>
                    <label>
                        <input name="ControlColspan" type="radio" value="1">
                        合并
                    </label>
                </div>
            </td>
        </tr>
        <tr>
            <th class="formTitle">默认值</th>
            <td class="formValue">
                <input id="ControlDefault" type="text" class="form-control" />
            </td>
        </tr>*@
    </table>
</div>

